package com.mall.business.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mall.business.domain.TProduct;
import com.mall.business.service.ITProductService;
import com.mall.common.exception.ServiceException;
import com.mall.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mall.business.mapper.TSeckillMapper;
import com.mall.business.domain.TSeckill;
import com.mall.business.service.ITSeckillService;

/**
 * 秒杀活动Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-29
 */
@Service
public class TSeckillServiceImpl extends ServiceImpl<TSeckillMapper, TSeckill> implements ITSeckillService {
    @Autowired
    private TSeckillMapper tSeckillMapper;

    @Autowired
    private ITProductService productService;


    /**
     * 查询秒杀活动
     *
     * @param id 秒杀活动主键
     * @return 秒杀活动
     */
    @Override
    public TSeckill selectTSeckillById(String id) {
        return tSeckillMapper.selectTSeckillById(id);
    }


    @Override
    public TSeckill selectTSeckillByIdApp(String id) {
        return tSeckillMapper.selectTSeckillById(id);
    }

    /**
     * 查询秒杀活动列表
     *
     * @param tSeckill 秒杀活动
     * @return 秒杀活动
     */
    @Override
    public List<TSeckill> selectTSeckillList(TSeckill tSeckill) {
        return tSeckillMapper.selectTSeckillList(tSeckill);
    }

    @Override
    public List<TSeckill> selectTSeckillListApp(TSeckill tSeckill) {
        return tSeckillMapper.selectTSeckillListApp(tSeckill);
    }

    /**
     * 新增秒杀活动
     *
     * @param tSeckill 秒杀活动
     * @return 结果
     */
    @Override
    public int insertTSeckill(TSeckill tSeckill) {
        tSeckill.setCreateTime(DateUtils.getNowDate());
        return tSeckillMapper.insertTSeckill(tSeckill);
    }

    /**
     * 修改秒杀活动
     *
     * @param tSeckill 秒杀活动
     * @return 结果
     */
    @Override
    public int updateTSeckill(TSeckill tSeckill) {
        tSeckill.setUpdateTime(DateUtils.getNowDate());
        return tSeckillMapper.updateTSeckill(tSeckill);
    }

    /**
     * 批量删除秒杀活动
     *
     * @param ids 需要删除的秒杀活动主键
     * @return 结果
     */
    @Override
    public int deleteTSeckillByIds(String[] ids) {
        return tSeckillMapper.deleteTSeckillByIds(ids);
    }

    /**
     * 删除秒杀活动信息
     *
     * @param id 秒杀活动主键
     * @return 结果
     */
    @Override
    public int deleteTSeckillById(String id) {
        return tSeckillMapper.deleteTSeckillById(id);
    }


}
